Fix casting problem in gmodule code.
authorBrian Cameron <Brian.Cameron@sun.com>
Fri, 24 Apr 2009 22:20:03 +0000 (17:20 -0500)
committerBrian Cameron <Brian.Cameron@sun.com>
Fri, 24 Apr 2009 22:20:03 +0000 (17:20 -0500)
This fixes bug 579884.  Previously the return value of g_slist_find_custom was
being recasted as type (GtkModuleInfo *).  This patch sets the return value
to a temporary variable of type (GSList *), and sets info to temp->data.  This
avoids a crashing problem.

gtk/gtkmodules.c

index dddee9d550c5fc6a644f198651a5736fc1b543fa..a6b40d88b5c870a840b6b3b45d17db5f32a0b45e 100644 (file)
@@ -289,9 +289,16 @@ load_module (GSList      *module_list,
                g_module_close (module);
              else
                {
+                 GSList *temp;
+
                  success = TRUE;
-                 info = (GtkModuleInfo *) g_slist_find_custom (gtk_modules, module,
-                                                               (GCompareFunc)cmp_module);
+                 info = NULL;
+
+                 temp = g_slist_find_custom (gtk_modules, module,
+                       (GCompareFunc)cmp_module);
+                 if (temp != NULL)
+                       info = temp->data;
+
                  if (!info)
                    {
                      info = g_new0 (GtkModuleInfo, 1);